package com.neu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neu.po.Dept;
import com.neu.po.ResponseResult;
import com.neu.service.DeptService;

@RestController
@RequestMapping("dept")
public class DeptController {
	@Autowired
	private DeptService deptService;
	
	@RequestMapping("insert")
	public ResponseResult insert(@RequestBody Dept dept) {
		ResponseResult result = new ResponseResult();
		
		result.setData(deptService.insert(dept));
		return result;
	}
	
	@RequestMapping("update")
	public ResponseResult update(@RequestBody Dept dept) {
		ResponseResult result = new ResponseResult();
		result.setData(deptService.update(dept));
		return result;
	}
	
	@RequestMapping("detele")
	public ResponseResult delete(int id) {
		ResponseResult result = new ResponseResult();
		result.setData(deptService.detele(id));
		
		return result;
	}
	@RequestMapping("getPaged")
	public ResponseResult getPaged(int pageNum, int pageSize) {
		ResponseResult result = new ResponseResult();
		result.setData(deptService.getPaged(pageNum, pageSize));
		return result;
	}
	
	@RequestMapping("getAll")
	public ResponseResult getAll() {
		ResponseResult result = new ResponseResult();
		result.setData(deptService.getAll());
		return result;
	}
	
	@RequestMapping("getById")
	public ResponseResult getById(int id) {
		ResponseResult result = new ResponseResult();
		result.setData(deptService.getById(id));
		return result;
	}
}
